this.addMenuItem(new PopupMenu.PopupSeparatorMenuItem());
- this.addAction(_('Quit'), () => this._app.request_quit());
+ this._quitItem =
+ this.addAction(_('Quit'), () => this._app.request_quit());
this._signals = [];
this._signals.push([
this._appSystem,
this._appSystem.connect('installed-changed',
() => this._updateDetailsVisibility()),
+ ], [
+ this._appSystem,
+ this._appSystem.connect('app-state-changed',
+ this._onAppStateChanged.bind(this)),
]);
+ this._updateQuitItem();
this._updateDetailsVisibility();
}
+ _onAppStateChanged(sys, app) {
+ if (this._app !== app)
+ return;
+
+ this._updateQuitItem();
+ }
+
+ _updateQuitItem() {
+ this._quitItem.visible = this._app?.state === Shell.AppState.RUNNING;
+ }
+
_updateDetailsVisibility() {
const sw = this._appSystem.lookup_app('org.gnome.Software.desktop');
this._detailsItem.visible = sw !== null;
this._newWindowItem.visible =
app && app.can_open_new_window() && !actions.includes('new-window');
+ this._updateQuitItem();
}
_queueUpdateWindowsSection() {